﻿#region Information
/*
 * Author: Zng Tfy
 * Email: nvt87x@gmail.com
 * Phone: +84 1645 515 010
 * ---------------------------
 * Create: 24/07/2012 21:33
 * Update: 02/06/2013 21:53
 * Status: OK
 */
#endregion

using System;
using System.Linq;
using System.Data;
using System.Collections.Generic;


namespace WS.BLL
{
    using SKG;
    using SKG.Extend;
    using SKG.Hasher;
    using DAL.Entities;
    using DevExpress.XtraEditors;

    public sealed class NguoidungBLL : DAL.NguoidungDAL
    {
        /// <summary>
        /// Check login
        /// </summary>
        /// <param name="acc">User's acount</param>
        /// <param name="pass">User's password</param>
        /// <returns></returns>
        public int CheckLogin(string acc, string pass)
        {
            if (acc.Trim() == "") return 0;
            DataTable ND = Select_By_Taikhoan(acc);
            if (ND == null || ND.Rows.Count == 0) return 1;
            if (pass.MaHoaMD5() != ND.Rows[0]["Matkhau"].ToString()) return 2;
            return 3;
        }

        /// <summary>
        /// Change password
        /// </summary>
        /// <param name="pass">New password need to change</param>
        /// <returns></returns>
        public bool ChangePass(string pass)
        {
            return false;
        }
    }
}